/*
 * @Descripttion: 
 * @version: 
 * @Author: sueRimn
 * @Date: 2022-10-28 16:01:21
 * @LastEditors: sueRimn
 * @LastEditTime: 2023-02-27 14:28:41
 */
import axios from 'axios';
import request from "../axios";
const detailPage = {
  getFormById(url, params) {
    return request({
      url: url + "detailPage/getFormById",
      method: "post",
      data: params
    })
  },
  //执行详情页面配置的请求  并发请求
  fetchRequest(rqList) {
    // let fun_arr = rqList.map((data) => {
    //   let service = data.service.startsWith("http") ? data.service : "http://localhost:8080/";
    //   return request({
    //     url: service + data.address,
    //     method: data.method,
    //     data: data.params
    //   })
    // });
    return axios.all(rqList.map((data) => {
      let service = data.service.startsWith("http") ? data.service : "http://localhost:8080/";
      return request({
        url: service + data.address,
        method: data.method,
        data: data.params
      })
    })).then(axios.spread((...res) => {
      return res;
    }))
  }
}
export default detailPage;